/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package forense.classes;

/**
 *
 * @author Kate
 */

import org.apache.log4j.Logger;



public class ArchivoLogger {

    private Logger logger;

    public ArchivoLogger(Class clase) {
        logger = Logger.getLogger(clase);
        //org.apache.log4j.PropertyConfigurator.configure(getClass().getResource("/lib/log4j.config"));
        //org.apache.log4j.PropertyConfigurator.configure("log4j.properties");
        //logger = Logger.getLogger("LogForense");
        logger = Logger.getRootLogger();
        

    }

    public void info(String message) {
        logger.info(message);
    }

    public void debug(String message) {
        logger.debug(message);
    }

    public void error(String mensaje) {
        logger.error(mensaje);

    }

    public void warn(String message) {
        logger.warn(message);
    }

    public void trace(String message) {
        logger.trace(message);
    }

    public void fatal(String message) {
        logger.fatal(message);
    }

    public void info(Exception e) {
        String log = "";
        log = e.toString() + "\n";
        StackTraceElement[] ste = new Throwable().getStackTrace();
        for (int i = 0; i < ste.length; i++) {
            log += "at " + ste[i].toString() + "\n";
        }
        logger.info(log);
    }

    public void debug(Exception e) {
        String log = "";
        log = e.toString() + "\n";
        StackTraceElement[] ste = new Throwable().getStackTrace();
        for (int i = 0; i < ste.length; i++) {
            log += "at " + ste[i].toString() + "\n";
        }
        logger.debug(log);
    }

    public void error(Exception e) {
        String log = "";
        log = e.toString() + "\n";
        StackTraceElement[] ste = new Throwable().getStackTrace();
        for (int i = 0; i < ste.length; i++) {
            log += "at " + ste[i].toString() + "\n";
        }
        logger.error(log);
    }

    public void warn(Exception e) {
        String log = "";
        log = e.toString() + "\n";
        StackTraceElement[] ste = new Throwable().getStackTrace();
        for (int i = 0; i < ste.length; i++) {
            log += "at " + ste[i].toString() + "\n";
        }
        logger.warn(log);
    }

    public void trace(Exception e) {
        String log = "";
        log = e.toString() + "\n";
        StackTraceElement[] ste = new Throwable().getStackTrace();
        for (int i = 0; i < ste.length; i++) {
            log += "at " + ste[i].toString() + "\n";
        }
        logger.trace(log);
    }

    public void fatal(Exception e) {
        String log = "";
        log = e.toString() + "\n";
        StackTraceElement[] ste = new Throwable().getStackTrace();
        for (int i = 0; i < ste.length; i++) {
            log += "at " + ste[i].toString() + "\n";
        }
        logger.fatal(log);
    }

}
